home *** CD-ROM | disk | FTP | other *** search
/ Programming Microsoft Visual Basic .NET / Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin / setup / vbnet / 16 windows forms / windowsformsdemo / dialogbaseform.vb < prev    next >
Encoding:
Text File  |  2002-01-15  |  5.5 KB  |  141 lines

  1. Public Class DialogBaseForm
  2.     Inherits System.Windows.Forms.Form
  3.  
  4. #Region " Windows Form Designer generated code "
  5.  
  6.     Public Sub New()
  7.         MyBase.New()
  8.  
  9.         'This call is required by the Windows Form Designer.
  10.         InitializeComponent()
  11.  
  12.         'Add any initialization after the InitializeComponent() call
  13.  
  14.     End Sub
  15.  
  16.     'Form overrides dispose to clean up the component list.
  17.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  18.         If disposing Then
  19.             If Not (components Is Nothing) Then
  20.                 components.Dispose()
  21.             End If
  22.         End If
  23.         MyBase.Dispose(disposing)
  24.     End Sub
  25.     Protected WithEvents btnOK As System.Windows.Forms.Button
  26.     Protected WithEvents btnCancel As System.Windows.Forms.Button
  27.     Protected WithEvents txtValue As System.Windows.Forms.TextBox
  28.     Protected WithEvents lblMessage As System.Windows.Forms.Label
  29.     Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
  30.  
  31.     'Required by the Windows Form Designer
  32.     Private components As System.ComponentModel.Container
  33.  
  34.     'NOTE: The following procedure is required by the Windows Form Designer
  35.     'It can be modified using the Windows Form Designer.  
  36.     'Do not modify it using the code editor.
  37.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  38.         Me.btnOK = New System.Windows.Forms.Button()
  39.         Me.txtValue = New System.Windows.Forms.TextBox()
  40.         Me.lblMessage = New System.Windows.Forms.Label()
  41.         Me.PictureBox1 = New System.Windows.Forms.PictureBox()
  42.         Me.btnCancel = New System.Windows.Forms.Button()
  43.         Me.SuspendLayout()
  44.         '
  45.         'btnOK
  46.         '
  47.         Me.btnOK.Anchor = (System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)
  48.         Me.btnOK.Location = New System.Drawing.Point(416, 32)
  49.         Me.btnOK.Name = "btnOK"
  50.         Me.btnOK.Size = New System.Drawing.Size(88, 32)
  51.         Me.btnOK.TabIndex = 2
  52.         Me.btnOK.Text = "OK"
  53.         '
  54.         'txtValue
  55.         '
  56.         Me.txtValue.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
  57.                     Or System.Windows.Forms.AnchorStyles.Right)
  58.         Me.txtValue.Location = New System.Drawing.Point(56, 64)
  59.         Me.txtValue.Name = "txtValue"
  60.         Me.txtValue.Size = New System.Drawing.Size(336, 24)
  61.         Me.txtValue.TabIndex = 1
  62.         Me.txtValue.Text = ""
  63.         '
  64.         'lblMessage
  65.         '
  66.         Me.lblMessage.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
  67.                     Or System.Windows.Forms.AnchorStyles.Right)
  68.         Me.lblMessage.Location = New System.Drawing.Point(56, 24)
  69.         Me.lblMessage.Name = "lblMessage"
  70.         Me.lblMessage.Size = New System.Drawing.Size(336, 40)
  71.         Me.lblMessage.TabIndex = 0
  72.         Me.lblMessage.Text = "Type your value here"
  73.         '
  74.         'PictureBox1
  75.         '
  76.         Me.PictureBox1.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
  77.         Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  78.         Me.PictureBox1.Location = New System.Drawing.Point(8, 24)
  79.         Me.PictureBox1.Name = "PictureBox1"
  80.         Me.PictureBox1.Size = New System.Drawing.Size(40, 40)
  81.         Me.PictureBox1.TabIndex = 3
  82.         Me.PictureBox1.TabStop = False
  83.         '
  84.         'btnCancel
  85.         '
  86.         Me.btnCancel.Anchor = (System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)
  87.         Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
  88.         Me.btnCancel.Location = New System.Drawing.Point(416, 72)
  89.         Me.btnCancel.Name = "btnCancel"
  90.         Me.btnCancel.Size = New System.Drawing.Size(88, 32)
  91.         Me.btnCancel.TabIndex = 3
  92.         Me.btnCancel.Text = "Cancel"
  93.         '
  94.         'DialogBaseForm
  95.         '
  96.         Me.AcceptButton = Me.btnOK
  97.         Me.AutoScaleBaseSize = New System.Drawing.Size(7, 17)
  98.         Me.CancelButton = Me.btnCancel
  99.         Me.ClientSize = New System.Drawing.Size(512, 149)
  100.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1, Me.txtValue, Me.btnOK, Me.lblMessage, Me.btnCancel})
  101.         Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  102.         Me.Name = "DialogBaseForm"
  103.         Me.Text = "DialogBaseForm"
  104.         Me.ResumeLayout(False)
  105.  
  106.     End Sub
  107.  
  108. #End Region
  109.  
  110.     ' This is the value typed by the user
  111.     Property InputValue() As String
  112.         Get
  113.             Return txtValue.Text
  114.         End Get
  115.         Set(ByVal Value As String)
  116.             txtValue.Text = Value
  117.         End Set
  118.     End Property
  119.  
  120.     Private Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Click
  121.         OnOkClick()
  122.     End Sub
  123.  
  124.     Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
  125.         OnCancelClick()
  126.     End Sub
  127.  
  128.     ' Since this form has been designed for being inherited from
  129.     ' we put the actual Button code in two Protected procedures
  130.     Protected Overridable Sub OnOkClick()
  131.         ' close this form
  132.         Me.DialogResult = DialogResult.OK
  133.     End Sub
  134.  
  135.     Protected Overridable Sub OnCancelClick()
  136.         ' close this form 
  137.         Me.DialogResult = DialogResult.Cancel
  138.     End Sub
  139.  
  140. End Class
  141.